﻿using www.w3.org.Item2001.XMLSchema;

namespace Sidvall.CodeGenerator.DataObjects
{
    public class SchemaImport : SchemaItem
    {
        public import Item { get; set; }

        public override string ToString()
        {
            return this.Item.schemaLocation.ToString();
        }
    }

    public class SchemaImportCollection : System.Collections.ObjectModel.KeyedCollection<import, SchemaImport>
    {

        #region Business Members

        #region Add

        public void Add(schema parent, import item, string fileName)
        {
            SchemaImport value;

            if (parent == null)
                throw new System.ArgumentNullException("parent");
            if (item == null)
                throw new System.ArgumentNullException("item");
            if (Contains(item))
                return;

            value = new SchemaImport()
            {
                Item = item,
                Parent = parent,
                FileName = fileName
            };
            Add(value);
        }

        #endregion
        #region GetKeyForItem

        protected override import GetKeyForItem(SchemaImport item)
        {
            if (item == null)
                throw new System.ArgumentNullException("item");
            return item.Item;
        }

        #endregion

        #endregion
        #region Constructors

        public SchemaImportCollection()
        {
        }

        #endregion

    }
}
